package com.example.boot.rtgoods.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.example.boot.rtgoods.service.RtGoodsService;
import com.example.boot.util.ResultData;
import com.example.boot.util.ResultUtil;

@RestController
public class RtGoodsController {
	@Autowired
	private RtGoodsService rtGoodsService;

	/**
	 * 根据桌子查找所有菜品以及商家详情
	 * 
	 * @param tableId
	 * @return
	 * @throws Exception
	 */
	@RequestMapping(value = "byTable/findGoods")
	public ResultData<Object> byTableIdFindGoods(String tableId) throws Exception {

		return ResultUtil.success(rtGoodsService.byTableIdFindGoods(tableId));
	}
	
	/**
	 * 根据店铺Id搜索商家信息
	 * @param shopId
	 * @return
	 * @throws Exception
	 */
	@RequestMapping(value = "byShopId/findGoods")
	public ResultData<Object> byShopIdFindGoods(String shopId)throws Exception{
		return ResultUtil.success(rtGoodsService.byShopIdFindGoods(shopId));

	}

}
